/**
 * 
 * @param {*} key 
 * @param {*} value 
 * @param {*} time 
 */
function setCookie(key,value,time){
    if( typeof value ==="object")value =JSON.stringify(value)
    let d = new Date();
    d.setTime(d.getTime()-1000*60*60*8+1000*time);
    document.cookie =`${key}=${value}; expires = ${d}`
}


/**
 * 
 * @param {*} key 
 */

function getCookie(key){
    
    let arr = document.cookie.split(';');
    console.log(document.cookie);
    let result = null
    arr.forEach((item,i)=>{
        let temp = item.split('=');
        if(temp[0]===key){
            result = temp[1]
        }
    })
    return result
}




function removeCookie(key){
  setCookie(key,null,-1)
}
    
